{% extends 'base.html' %}
{% load static %}
{% load bootstrap3 %}

{% block title %}
新增设备入库
{% endblock %}

{% block breadcrumb %}
<li id="orbit"><a href="{%url 'stock:deviceins' %}">设备入库列表</a></li>
<li id="orbit" class="active">
    {% if new %}
    新增设备入库
    {% else %}
    设备入库更新
    {% endif %}
</li>
{% endblock %}

{% block maincontent %}
<form id="warehouseForm" role="form" class="form-horizontal container" method="post" action="#">
    {% csrf_token %}

    <div class="widget-box">
        <div class="widget-header">
            <h4 class="widget-title">入库信息</h4>
            <div class="widget-toolbar">
                <a href="#" data-action="collapse">
                    <i class="ace-icon fa fa-chevron-up"></i>
                </a>
                <a href="#" data-action="close">
                    <i class="ace-icon fa fa-times"></i>
                </a>
            </div>
        </div>
        <div class="widget-body">
            <div class="widget-main">
                {% for field in form %}
                <div class="form-group">
                    {{ field.errors }}
                    <div class="col-sm-2">{{ field.label_tag }}</div>
                    <div class="col-sm-10">{{ field }}</div>
                    {% if field.help_text %}
                    <p class="help">{{ field.help_text|safe }}</p>
                    {% endif %}
                </div>
                {% endfor %}
            </div>
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-11">
            <button id="oper" type="submit" class="btn btn-primary">确认</button>
            <button type="button" class="btn btn-default">取消</button>
        </div>
    </div>
    {% if alert == 'T' %}
    <div id="alert" class="alert alert-dismissable alert-success">库房信息添加成功！</div>
    {% elif alert == 'F' %}
    <div id="alert" class="alert alert-dismissable alert-warning">添加失败，稍后请重试</div>
    {% else %}
    <div id="alert"></div>
    {% endif %}
</form>
</div>
{% endblock %}

{% block script %}
<script type="text/javascript" src="{% static 'admin/js/vendor/jquery/jquery.js' %}"></script>

{{ form.media }}
<script type="text/javascript" src="/static/scripts/mainInit/warehouse.js"></script>
{% endblock %}